<!DOCTYPE html>
<html>

{include file='public/header'}

<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="javascript:void(0)">首页</a>
            <a href="javascript:void(0)">投放管理</a>
            <a><cite>快手投放总览统计</cite></a>
        </span>
        <a class="layui-btn layui-btn-small" id="reload" title="刷新">
            <i class="layui-icon" style="line-height:30px"><i class="iconfont">&#xe6aa;</i></i>
        </a>
    </div>
    <div class="x-body">
        <fieldset class="layui-elem-field">
            <legend>数据统计</legend>
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <div class="layui-carousel x-admin-carousel x-admin-backlog" style="width: 100%">
                            <ul class="layui-row layui-col-space10 layui-this">
                                <li class="layui-col-xs6 layui-col-sm3 layui-col-md2">
                                    <a href="javascript:;" class="x-admin-backlog-body">
                                        <h3>累计充值</h3>
                                        <p><cite id="total_recharge"></cite></p>
                                    </a>
                                </li>
                                <li class="layui-col-xs6 layui-col-sm3 layui-col-md2">
                                    <a href="javascript:;" class="x-admin-backlog-body">
                                        <h3>当月充值</h3>
                                        <p><cite id="this_month_recharge"></cite></p>
                                    </a>
                                </li>
                                <li class="layui-col-xs6 layui-col-sm3 layui-col-md2">
                                    <a href="javascript:;" class="x-admin-backlog-body">
                                        <h3>上月充值</h3>
                                        <p><cite id="last_month_recharge"></cite></p>
                                    </a>
                                </li>
                                <li class="layui-col-xs6 layui-col-sm3 layui-col-md2">
                                    <a href="javascript:;" class="x-admin-backlog-body">
                                        <h3>累计成本</h3>
                                        <p><cite id="total_spend"></cite></p>
                                    </a>
                                </li>
                                <li class="layui-col-xs6 layui-col-sm3 layui-col-md2">
                                    <a href="javascript:;" class="x-admin-backlog-body">
                                        <h3>总关注用户</h3>
                                        <p><cite id="total_user"></cite></p>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </fieldset>
        <table id="launchDataList" lay-filter="launchDataList"></table>
    </div>
    <script type="text/html" id="tbBar">
        <a class="layui-btn layui-btn-xs" lay-event="look">查看</a>
    </script>
    <script>
        Ajax('/admin/launch/kwaiOverviewStatistics', {}).then(data => {
            var keys = Object.keys(data.data);
            for (var i = 0; i < keys.length; i++) {
                $(`#${keys[i]}`).html(data.data[keys[i]])
            }
        });
        let params = {
            elem: '#launchDataList'
            , toolbar: '#toolbarDem o'
            , url: '/admin/launch/kwaiLaunchDataList' //数据接口
            , id: 'launchDataList'
            , limit:15
            , page:true
            , cols: [[ //表头
                {title: '平台', templet: function (d) {
                        return d.platform == 1 ? '抖音巨量' : '快手磁力'
                    }
                }
                , { field: 'date', title: '日期', }
                , { field: 'total_cost', title: '总花费', }
                , { field: 'register_user_num', title: '注册用户数', }
                , { field: 'current_recharge', title: '当天充值', }
                , { field: 'current_recovery', title: '当天回收百分比', }
                , { field: 'total_recharge', title: '累计充值', }
                , { field: 'total_recovery', title: '累计回收百分比', }
                , { field: 'fans_cost', title: '粉丝成本', }
                , { field: 'revenue', title: '营收情况', }
                , { field: 'per_capita_contribution', title: '人均贡献', }
                , { toolbar: '#tbBar', title: '操作', }
                
            ]]
        }
        tableList(params)

        layui.use('table', function () {
            var table = layui.table;
            table.on('tool(launchDataList)', function (obj) {
                var event = obj.event;
                if (event === 'look') {
                    x_admin_show('查看', `./info.html?media_id=2&date=${obj.data.date}`, 1400, 730,null);
                }
            });
        });
    </script>
</body>

</html>